import { useEventListener } from '@vueuse/core';

export interface UseScaleByWheelOptions {
  target?: HTMLElement;
}
export function useScaleByWheel(useScaleByWheelOptions: UseScaleByWheelOptions = {}) {
  const distanceDiff = ref(0);
  const { target = window } = useScaleByWheelOptions;
  useEventListener(target, 'wheel', (wheelEvent) => {
    // console.log(wheelEvent);
    distanceDiff.value += (wheelEvent as WheelEvent).deltaY;
    wheelEvent.stopPropagation();
    wheelEvent.preventDefault();
  });
  return {
    distanceDiff
  };
}
